version: '3.7'
services:
  jenkins:
    build:
      context: ./docker/common/jenkins
    ports:
      - "8000:8080"
    restart: always
    environment:
      DOCKER_HOST: tcp://docker:2376
      DOCKER_CERT_PATH: /certs/client
      DOCKER_TLS_VERIFY: 1
    volumes:
      - jenkins-data:/var/jenkins_home:rw
      - docker-certs:/certs/client:ro
      - /root/.ssh:/jenkins/.ssh
    depends_on:
      - docker
  docker:
    build:
      context: ./docker
    privileged: true
    restart: always
    environment:
      DOCKER_TLS_CERTDIR: /certs
    volumes:
      - docker-certs:/certs/client
      - jenkins-data:/var/jenkins_home:rw
      - docker-data:/var/lib/docker
  registry:
    restart: always
    image: registry:2.8.1
    ports:
      - "5000:5000"
    environment:
      REGISTRY_AUTH: htpasswd
      REGISTRY_AUTH_HTPASSWD_REALM: Realm
      REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
    volumes:
      - registry:/var/lib/registry
      - ./htpasswd:/auth/htpasswd

volumes:
  jenkins-data:
  docker-certs:
  docker-data:
  registry: